﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BusinessLogic;
using Hazop.Actions;

namespace Hazop
{
    static class Program{
        public static Form MainForm;
        public static Icon AppIcon;
        public static Workspace Workspace;
        /// <summary>
        /// The main entry point for the application.
        /// 
        /// Writen by lhcxx
        /// </summary>
        
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Workspace = new Workspace();

            try{
                AppInitAction action = new AppInitAction();
                action.RunInProgress();
                LoginForm loginForm = new LoginForm();
                if (loginForm.ShowDialog() == DialogResult.OK)
                {
                    MainForm form = new MainForm();
                    MainForm = form;
                    Application.Run(form);
                }
            }
            catch (Exception e){
                MessageBox.Show(e.Message);
                return;
            }


//            LoginForm loginForm = new LoginForm();
//            if(loginForm.ShowDialog() == DialogResult.OK) {
//                MainForm form = new MainForm();
//                MainForm = form;
//                Application.Run(form);
//            }
        }
    }
}
